Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ANSI escape color codes in NINJA_STATUS #1454

Closed
wants to merge 1 commit into from

Conversation

mqudsi
Copy link
Contributor

@mqudsi mqudsi commented Jul 30, 2018

Adds support for ANSI escape sequences used for colorization to the job
status indicator, and updates ElideMiddle() to account for the
non-obvious change in text width.

As an example, the following will now emit the job status in green:

env NINJA_STATUS="\\033[32m[%f/%t] \\033[0m" ninja;

Invalid color escape codes are treated as plain text (as before). ANSI
escape sequences apart from \033...m are not supported.

Closes #713. Closes #912.

Adds support for ANSI escape sequences used for colorization to the job
status indicator, and updates `ElideMiddle()` to account for the
non-obvious change in text width.

As an example, the following will now emit the job status in green:

   env NINJA_STATUS="\\033[32m[%f/%t] \\033[0m" ninja;

Invalid color escape codes are treated as plain text (as before). ANSI
escape sequences apart from `\033...m` are not supported.

Closes ninja-build#713. Closes ninja-build#912.
@mqudsi mqudsi force-pushed the ninja_status_color branch from 75e818c to 5f42d00 Compare July 30, 2018 23:51
mqudsi added a commit to mqudsi/ninja that referenced this pull request Jul 31, 2018
Set the default `NINJA_STATUS` and the "FAILED" text on job failure to
use ANSI color code escapes if running under a smart terminal.

Requires ninja-build#1454 to be merged first.
@mathstuf
Copy link
Contributor

mathstuf commented Aug 9, 2018

If this is used over #912, the first commit of that PR is still relevant.

@jhasse
Copy link
Collaborator

jhasse commented Nov 7, 2018

btw: ANSI escape color codes in NINJA_STATUS should already work using the following:

env $'NINJA_STATUS=\x1b[32m[%f/%t] \x1b[0m' ninja

It's true that this will break ElideMiddle though.

@jhasse
Copy link
Collaborator

jhasse commented Nov 14, 2018

Superseded by #1494.

@jhasse jhasse closed this Nov 14, 2018
mqudsi added a commit to mqudsi/ninja that referenced this pull request Jan 1, 2019
Set the default `NINJA_STATUS` and the "FAILED" text on job failure to
use ANSI color code escapes if running under a smart terminal.

Requires ninja-build#1454 to be merged first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants